#ifndef __DECOMPILE_FUNCTION__
#define __DECOMPILE_FUNCTION__

#include<vector>
#include<string>
#include<fstream>

namespace LLVMDecompiler
{
	class DecompiledFunction
	{
		public:
			DecompiledFunction(std::string N)
			    : Name(N)
            {
			}

            DecompiledFunction(void) { }
            
            std::string getFunctionName(void) { return Name; }
            void setFunctionName(std::string N) { Name = N; }

            void print(std::fstream S)
            {
                S << ReturnType << " " 
                << Name
                ;

                S << "(";
                if (Arguments.size() >= 1)
                    S << Arguments[0];
                
                for (std::vector<std::string>::iterator I = Arguments.begin(),
                    E = Arguments.end(); I != E; ++I)
                {
                    S << ", " << *I;
                }
                S << ")";

                S << "\n{\n";

                for (std::vector<std::string>::iterator I = Statements.begin(),
                    E = Statements.end(); I != E; ++I)
                {
                    S << *I << ";\n";
                }

                S << "\n}\n";
            }

            void addStatement(std::string S) { Statements.push_back(S); }

		private:
			std::string Name;
            std::vector<std::string> Statements;
            std::string ReturnType;
            std::vector<std::string> Arguments;
	};
}
#endif
